import 'package:flutter/material.dart';

class HomeNav extends StatelessWidget {
  const HomeNav({super.key});

  @override
  Widget build(BuildContext context) {
    // 导航数据
    List navList = [
      {
        'title': '我的房屋',
        'icon': 'assets/images/house_nav_icon@2x.png',
      },
      {
        'title': '我的报修',
        'icon': 'assets/images/repair_nav_icon@2x.png',
      },
      {
        'title': '访客登记',
        'icon': 'assets/images/visitor_nav_icon@2x.png',
      }
    ];

    return Container(
      margin: const EdgeInsets.only(left: 10, right: 10),
      padding: const EdgeInsets.only(top: 20, bottom: 20),
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(10),
      ),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceAround,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: navList
            .map((item) => Column(
                  children: [
                    Image.asset(item['icon'], width: 40, height: 40),
                    Text(item['title'],
                        style: const TextStyle(
                            fontSize: 12, color: Color(0xff434242))),
                  ],
                ))
            .toList(),
      ),
    );
  }
}
